#include <iostream>
#include <config/config_server/config_dao.h>
#include <xplatform/protobuf/xmsg_com.pb.h>
#include <xplatform/XCom.h>
using namespace std;

int main(int argc, char *argv[]){
    cout<<"config server"<<endl;
    if(!ConfigDao::Get()->Init("127.0.0.1","root","13356hhhhh","xms")){
        cout<<"init config failed"<<endl;
        return 1;
    }
    cout<<"init config success"<<endl;
    if(!ConfigDao::Get()->Install()){
        cout<<"install config failed"<<endl;
        return 1;
    }
    cout<<"install config success"<<endl;
#if defined(XCOM_DEBUG)&&0
    xmsg::XConfig config;
    config.set_service_name("test");
    config.set_service_ip("127.0.0.1");
    config.set_service_port(20012);
    config.set_proto("1234");
    if(!ConfigDao::Get()->SaveConfig(&config)){
        cout<<"SaveConfig failed"<<endl;
        return 1;
    }
    cout<<"SaveConfig success"<<endl;
#else
    xmsg::XConfig config=ConfigDao::Get()->LoadConfig("127.0.0.1",20012);
    std::cout<<config.DebugString()<<std::endl;
#endif
}